#!/bin/bash

# Disable the crash report.
defaults write com.apple.CrashReporter DialogType none

root_path="../../DerivedData/MySQLWorkbench/Build/Products/Debug/MySQLWorkbench.app/Contents"
test_binary="$root_path/MacOS/wbtests"

program_path=$(cd $(dirname $0);pwd)

test_path=`cd $program_path/../DerivedData;pwd`

if ! test -d $test_path; then
  echo "Must be called from testing/ directory"
  exit 1
fi

pushd test-suite

export MWB_DATA_DIR="$root_path/Resources"
export TEST_MODULES_DIR="$root_path/Plugins"

echo "PATHS:"
echo $MWB_DATA_DIR
echo $TEST_MODULES_DIR

$test_binary

# Enable the crash reporter again.
defaults write com.apple.CrashReporter DialogType crashreport

popd
